package com.bookpavilion.chat.dao;

import com.bookpavilion.chat.pojo.Message;
import com.mongodb.client.result.DeleteResult;
import com.mongodb.client.result.UpdateResult;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;

import java.util.Optional;

public interface MessageDao extends MongoRepository<Message,String> {

    /**
     * 查询点对点聊天记录
     * @param fromid
     * @param toId
     * @param page
     * @param row
     * @return
     */
    @Query(value = "{'from.id':'?0','to.id':'?1','status':'{$ne:-1}'}")
    Page<Message> queryChatRecord(String fromid, String toId, Pageable pageable);







}
